package com.zmn.mcc.controller;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.mcc.dubbo.dto.DubboConsts;
import com.zmn.mcc.dubbo.interfaces.permit.PermitListRemoteService;
import com.zmn.mcc.dubbo.interfaces.staff.StaffListRemoteService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * 描述:
 *
 * @author jiafei
 * @version 1.0
 * @since 2022/7/27 15:51
 */
@RestController
@RequestMapping("/test/dubbo/staff")
public class StaffController {

    @DubboReference(version = DubboConsts.INTERFACE_VERSION, check = false)
    private StaffListRemoteService staffListRemoteService;

    @DubboReference(version = DubboConsts.INTERFACE_VERSION, check = false)
    private PermitListRemoteService permitListRemoteService;

    @GetMapping("/test1")
    public ResponseDTO<?> test1() {

        return staffListRemoteService.listSimpleStaffByDeptIds(4358, Arrays.asList(4364, 4361));
    }


    @GetMapping("/test2")
    public ResponseDTO<?> test2() {
        List<String> urls = Arrays.asList(
                "/base/marketing/account/addModify.action",
                "/base/marketing/shop/list.action",
                "/base/marketing/account/list.action",
                "/base/marketing/shop/modify/syncShop.action",
                "/base/marketing/account/copyPassWord.action"
        );

        return permitListRemoteService.checkPermitUrls("BFM-PLAT", urls);
    }
}
